package com.neymar.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.neymar.entity.Progress;
import com.neymar.entity.User;
import com.neymar.mapper.ProgressMapper;
import com.neymar.service.ProgressService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 求职进度表 服务实现类
 * </p>
 *
 * @author neymar
 * @since 2021-06-02
 */
@Service
public class ProgressServiceImpl implements ProgressService {

    @Autowired
    private ProgressMapper progressMapper;

    @Override
    public int save(Progress progress) {
        return progressMapper.insert(progress);
    }

    @Override
    public int deleteProgressById(String userId) {
        return progressMapper.deleteById(userId);
    }

    @Override
    public int updateProgressById(Progress progress) {
        return progressMapper.updateById(progress);
    }

    @Override
    public Progress findProgress(String userId) {
        QueryWrapper<Progress> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("user_id", userId);
        return progressMapper.selectOne(queryWrapper);
    }

}
